import {Component} from 'react';
import './index.less';
import {Switch,Route} from 'react-router-dom';
import Demo from './demo/index.jsx';

import { Layout, Icon } from 'antd';
const { Header, Sider, Content } = Layout;

import Menulayout from './Menulayout.jsx';

class admin extends Component {

    constructor(props) {
        super(props);
        this.state = {
            collapsed: false,
        };
    }

    componentWillMount () {

    }


    toggle() {
        this.setState({
            collapsed: !this.state.collapsed,
        });
    }
    componentDidMount () {

    }
    render() {
        return (
            <Layout>
                <Sider
                    trigger={null}
                    collapsible
                    collapsed={this.state.collapsed}
                >
                    <div className="logo" />
                    <Menulayout history={this.props.history}></Menulayout>
                </Sider>
                <Layout>
                    <Header style={{ background: '#fff', padding: 0 }}>
                        <Icon
                            className="trigger"
                            type={this.state.collapsed ? 'menu-unfold' : 'menu-fold'}
                            onClick={this.toggle.bind(this)}
                        />
                    </Header>
                    <Content style={{ margin: '24px 16px', padding: 24, background: '#fff', minHeight: 280 }}>
                        <Switch>
                            <Route key="demo" path="/page/demo" exact component={Demo}/>
                            <Route key="UndefinedPage"  component={Demo}/>
                        </Switch>
                    </Content>
                </Layout>
            </Layout>
        );
    }
}


export default admin;



